#ifndef _BSP_MAINPWM_H
#define _BSP_MAINPWM_H
#include "driver/ledc.h"
#include "driver/gpio.h"

#define LEDC_TIMER              LEDC_TIMER_0
#define LEDC_MODE               LEDC_LOW_SPEED_MODE
#define LEDC_OUTPUT_IO1         (GPIO_NUM_48) 
#define LEDC_OUTPUT_IO2         (GPIO_NUM_47) 
#define LEDC_CHANNEL1           LEDC_CHANNEL_0
#define LEDC_CHANNEL2           LEDC_CHANNEL_1
#define LEDC_DUTY_RES           LEDC_TIMER_13_BIT // Set duty resolution to 13 bits
#define LEDC_FREQUENCY          (12) 


#define GPIO_220V1_PORT           GPIO_NUM_2
#define GPIO_220V2_PORT           GPIO_NUM_3

#define GPIO_XUSHI_PORT1         GPIO_NUM_36
#define GPIO_XUSHI_PORT2         GPIO_NUM_35
#define GPIO_CILI_PIN_SEL      ((1ULL<<GPIO_XUSHI_PORT1) | (1ULL<<GPIO_XUSHI_PORT2) | (1ULL<<GPIO_220V1_PORT) | \
                                    (1ULL<<GPIO_220V2_PORT) | (1ULL<<LEDC_OUTPUT_IO1) | (1ULL<<LEDC_OUTPUT_IO2))


enum{
    SHI_MODE = 0,
    XU_MODE = 1,
};


enum{
    MAINPWM_NORMAL = 0,
    MAINPWM_DUTYCHANGE = 1,
    MAINPWM_STOP = 2,
};

enum{
    MAG_220V_NORMAL = 1,
    MAG_220V_DUTYCHANGE = 2,
    MAG_220V_STOP = 3,
};

void mainpwm_init(void);
void mainpwm_xushi_set(uint8_t xushi_status);
void mainpwm1_set_duty(uint16_t duty);
void mainpwm2_set_duty(uint16_t duty);
void mainpwm_set_freq(uint32_t freq);
void mainpwm_output_mode(uint8_t output_mode);
#endif




